﻿import flash.external.*

function close()
{
	ExternalInterface.call("td_achieve.close");
}

function on_scroll(e:Object)
{
	ExternalInterface.call("td_achieve.on_scroll", e.position);
}

var uiloaderIconList:Array = [];
var labelNameList:Array = [];
var labelTipsList:Array = [];
var labelScoreList:Array = [];
var labelFinishList:Array = [];

var AchieveList:Array = [Achieve_0, Achieve_1, Achieve_2, Achieve_3, Achieve_4];

function refresh_achieve_list()
{
	for (var i:Number = 0; i < AchieveList.length; i++)
	{
		if (i >= labelNameList.length)
		{
			AchieveList[i]._visible = false;
			continue;
		}
		AchieveList[i]._visible = true;
		AchieveList[i].labelName.text = labelNameList[i];
		AchieveList[i].labelTips.text = labelTipsList[i];
		AchieveList[i].labelScore.text = labelScoreList[i];		
		
		if (labelFinishList[i] == 1)
		{
			AchieveList[i].labelFinish.text = "已完成";
			AchieveList[i]._alpha = 100
		}
		else 
		{
			AchieveList[i].labelFinish.text = "未完成";
			AchieveList[i]._alpha = 50
		}
		if (uiloaderIconList[i] != null)
		{
			trace(AchieveList[i].uiloaderIcon)
			trace(AchieveList[i].uiloaderIcon.source)
			AchieveList[i].uiloaderIcon.source = uiloaderIconList[i].toString()
		}
			
	}
}

function set_scroll_bar_max_pos(max_pos:Number)
{	
	ScrollBar.setScrollProperties(AchieveList.length, 0, int(max_pos), 1);
	ScrollBar.position = 0;
}



btnClose.addEventListener("click", this, "close");
btnClose.disableFocus = true;
ScrollBar.addEventListener("scroll", this, "on_scroll");
ScrollBar.thumb.disableFocus = true;
ScrollBar.upArrow.disableFocus = true;
ScrollBar.downArrow.disableFocus = true;
ScrollBar.track.disableFocus = true;




